Skip to content

feat(web): linha do tempo cívica — torna os 130k civic_events visíveis - #37

Merged
pmarcura merged 1 commit into
mainfrom
feat/linha-do-tempo-civica
May 30, 2026
Merged

feat(web): linha do tempo cívica — torna os 130k civic_events visíveis#37
pmarcura merged 1 commit into
mainfrom
feat/linha-do-tempo-civica

Conversation

@pmarcura

Copy link
Copy Markdown
Owner

O que muda

A fundação cívica do codex construiu ~130 mil eventos no banco — mas estavam invisíveis (o app só mostrava o JSON antigo). Esta é a Onda 1: torná-los visíveis.

  • /eventos — linha do tempo cívica lendo civic_events real: total, filtros por categoria com contagem, cards com fonte e valor sempre visíveis + link "ver documento".
  • lib/eventos.ts — read model resiliente (sem DATABASE_URL degrada pra vazio → build no CI não quebra) + helpers de legibilidade pro cidadão.
  • @deolho/db reexporta operadores do Drizzle (o app não declara drizzle-orm direto).

Validação (live, com o banco real)

  • HTTP 200 · 129.736 eventos · 50 cards · 96 links de fonte
  • Filtros corretos: Pagamento (124.794) · Receita (4.071) · Contrato (602) · Sanção (20)
  • pnpm -r build / lint / typecheck ✅ (/eventos é ƒ dynamic)

Próximas ondas

  1. legibilidade dos títulos · 3) Câmara (SISCAM) · 4) PNCP licitações + CEIS · 5) enriquecimento Wikidata + casamento · 6) TSE

Tipo

  • ✨ Nova funcionalidade (produto)

Conecta o app ao banco canônico que o codex construiu: a página /eventos
lê os ~130 mil acontecimentos reais de Americana (pagamentos, contratos,
atos, sanções, receitas) direto de civic_events.

- lib/eventos.ts: read model resiliente (degrada para vazio sem DATABASE_URL,
  então o build no CI não quebra); helpers de legibilidade pro cidadão
  (categoria, fonte humana, valor BRL, data extensa)
- app/eventos/page.tsx: força dynamic (lê banco em runtime); cabeçalho com
  total real, filtros por categoria com contagem, cards com FONTE e VALOR
  sempre visíveis + link "ver documento"
- @deolho/db reexporta operadores do drizzle (app não declara drizzle direto)
- web passa a depender de @deolho/db (workspace)

Validado live: HTTP 200, 129.736 eventos, 50 cards, filtros corretos
(Pagamento 124.794 · Contrato 602 · Sanção 20). Build/lint/typecheck OK.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@pmarcura
pmarcura merged commit 1e91311 into main May 30, 2026
5 checks passed
@pmarcura
pmarcura deleted the feat/linha-do-tempo-civica branch May 30, 2026 17:39

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: f307e0006a

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +140 to +147
return (
<article className="rounded-xl border border-foreground/10 bg-card p-4">
<header className="flex items-center justify-between gap-2">
<span className="inline-flex items-center gap-1.5 text-xs font-semibold text-foreground/60">
<span aria-hidden>{meta.emoji}</span>
{meta.label}
</span>
<span className="text-[11px] text-muted-foreground">{dataExtensa(evento.dataEvento)}</span>

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Show the required disclaimer for attention signals

When civic_events includes rows with trust_type = 'sinal_atencao' (for example the existing diário mapper writes limitacao_fonte events this way for unclassified publications), this card renders them just like official facts and never displays the required warning that an attention signal does not indicate irregularity. That makes the new public timeline violate the product rule for signals of attention in exactly the all-events view where those rows will appear.

Useful? React with 👍 / 👎.

Comment on lines +27 to +36
const CATS_VALIDAS: CategoriaEvento[] = [
"contratacao",
"pagamento",
"receita",
"ato_normativo",
"nomeacao_exoneracao",
"sancao",
"audiencia_conselho",
"obra_zeladoria",
];

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Accept every category emitted by the stats chips

The filter UI renders one chip for every category returned by getEventosStats(), but this whitelist rejects several valid database enum values (limitacao_fonte, proposta_legislativa, indicacao_requerimento, relacionamento). If any of those rows exist, the generated chip links to /eventos?cat=..., then this validation drops the category to undefined, so the user gets the unfiltered timeline and the chip can never become active.

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant